package com.example.broadcastbestpractice;

import java.util.ArrayList;
import java.util.LinkedList;

public class UtilActivityController {
    // 静态对象
    public static LinkedList<BaseActivity> activities = new LinkedList<>();

    public static void addActivity(BaseActivity baseActivity) {
        activities.add(baseActivity);
    }

    public static void remove(BaseActivity baseActivity) {
        activities.remove(baseActivity);
    }

    public static void removeAll() {
        for(BaseActivity activity : activities){
            if(!activity.isFinishing()) {
                activity.finish();
            }
        }
    }
}

